#ifndef HUD_H
#define HUD_H

#include "Renderer.h"
#include "SurfaceRenderingData.h"

/**
 * FTGL lib used for rendering text:
 * http://sourceforge.net/apps/mediawiki/ftgl/index.php?title=Main_Page
 *
 * FTGL uses freetype lib:
 * http://www.freetype.org/index2.html
 */

#include "ftgl/ftgl/ftgl.h"

class Hud {
private:
	static GLdouble prevProjectionMatrix[16];
	static GLdouble prevModelviewMatrix[16];
	static FTTextureFont font;
	static FTBitmapFont bitmapFont;

public:
	static void Init();

	static void Begin();
	static void End();

	static inline void SetHudElement(unsigned int element) { glLoadName((GLuint)element); }
	static unsigned int CheckHit(int x, int y);

	static inline int GetTextMargin() { return 3; }
	static inline int GetCharHeight() { return 22; }
	static float GetTextLineHeight(int lineNumber, bool fromTop);

	static void TextBase(const char* text, float x, float y);
	static void TextBaseBitmap(const char* text, float x, float y);
	static void TextFg(const char* text, float x, float y);
	static void TextBg(const char* text, float x, float y);
	static void Text(const char* text, float x, float y, bool centered, const SurfaceRenderingData& fg, const SurfaceRenderingData& bg);

	static void Arrow(float size);
	static void Rect(float x1, float y1, float x2, float y2);
	static void Line(float x1, float y1, float x2, float y2);
	static void Image(DevilTexture *texture, float x, float y);
};

#endif //HUD_H
